"""地址：http://121.40.86.4:8899/admin/login
账号：admin
密码：Aa010903!
用例一：
1、用户登录
2、点击用户
3、点击用户分组
4、添加用户分组
5、判断添加是否成功
6、删除用户分组
7、判断删除是否是成功的
用例二：
1、登录
2、点击客服
3、客服话术
4、新增客服话术
5、看新增是否是成功的"""
""""import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
#实例化驱动
driver = webdriver.Chrome()
#打开网页
driver.get("http://121.40.86.4:8899/admin/login")
#设置全屏
driver.maximize_window()
# 设置隐式等待
driver.implicitly_wait(15)
#输入账号
driver.find_elements(By.CLASS_NAME,"el-input__inner")[0].send_keys("admin")
#输入密码
driver.find_elements(By.CLASS_NAME,"el-input__inner")[1].send_keys("Aa010903!")
#点击登录
driver.find_element(By.XPATH,"//*[@id='app']/div[1]/div[1]/div[2]/form/div[3]/div/button").click()
time.sleep(5)
#点击用户
driver.find_elements(By.CLASS_NAME,"font12")[1].click()
time.sleep(2)
#点击用户分组
driver.find_element(By.XPATH,"//*[text()='用户分组']").click()
time.sleep(2)
# #点击添加分组
# driver.find_element(By.XPATH,"//*[text()='添加分组']").click()
# time.sleep(2)
# #输入分组名称
# driver.find_elements(By.CLASS_NAME,"el-input__inner")[2].send_keys("liuhao")
# time.sleep(5)
# #点击确定
# driver.find_elements(By.CLASS_NAME,"el-button")[2].click()
# time.sleep(2)
#判读添加是否成功
# text = driver.find_element(By.XPATH,"//*[@id='app']/section/div[2]/section/div/div[1]/div/main/div/div[1]/div/div[1]/div/div/div/div[2]/div[3]/table/tbody/tr[3]/td[2]/div/span").text
# assert text == "liuhao"
# time.sleep(2)
#删除用户分组
# driver.find_element(By.XPATH,"//*[@id='app']/section/div[2]/section/div/div[1]/div/main/div/div[1]/div/div[1]/div/div/div/div[2]/div[4]/div[2]/table/tbody/tr[3]/td[3]/div/a[2]").click()
# time.sleep(2)
# #点击确定
# driver.find_elements(By.CLASS_NAME,"el-button")[2].click()
# #判断删除是否是成功的
# text = driver.find_element(By.XPATH,"//*[text()='liuhao']").text
# assert text == 'liuhao'
# time.sleep(2)"""
"""用例二：
1、登录
2、点击客服
3、客服话术
4、新增客服话术
5、看新增是否是成功的"""
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
#实例化驱动
driver = webdriver.Chrome()
#打开网页
driver.get("http://121.40.86.4:8899/admin/login")
#设置全屏
driver.maximize_window()
# 设置隐式等待
driver.implicitly_wait(15)
#输入账号
driver.find_elements(By.CLASS_NAME,"el-input__inner")[0].send_keys("admin")
#输入密码
driver.find_elements(By.CLASS_NAME,"el-input__inner")[1].send_keys("Aa010903!")
#点击登录
driver.find_element(By.XPATH,"//*[@id='app']/div[1]/div[1]/div[2]/form/div[3]/div/button").click()
time.sleep(5)
#点击客服
driver.find_elements(By.CLASS_NAME,"font12")[6].click()
time.sleep(2)
#点击客服话术
driver.find_elements(By.CLASS_NAME,"el-menu-item")[1].click()
time.sleep(2)
# #点击添加话术
# driver.find_element(By.CLASS_NAME,"el-button").click()
# time.sleep(2)
# # 点击话术分类
# driver.find_elements(By.CLASS_NAME,"el-input__inner")[2].click()
# time.sleep(2)
# #选择话术
# driver.find_elements(By.CLASS_NAME,"el-select-dropdown__item")[4].click()
# time.sleep(2)
# #话术标题
# driver.find_elements(By.CLASS_NAME,"el-textarea__inner")[0].send_keys("刘昊")
# time.sleep(2)
# #话术内容
# driver.find_elements(By.CLASS_NAME,"el-textarea__inner")[1].send_keys("aaaaaa")
# time.sleep(2)
# #点击确定
# driver.find_elements(By.CLASS_NAME,"el-button")[2].click()
# time.sleep(2)
#挑选第二页
driver.find_element(By.XPATH,"//*[@id='app']/section/div[2]/section/div/div[1]/div/main/div/div[1]/div/div[1]/div/div/div[2]/div/div/div[3]/div/div/ul/li[2]").click()
time.sleep(5)
#看新增是否是成功的
text = driver.find_element(By.XPATH,"//*[text()='刘昊']").text
assert text == '刘昊'
time.sleep(5)